package com.woniuxy.usercoachassemble.controller;

import com.woniuxy.usercoachassemble.entity.YogaGymInfo;
import com.woniuxy.usercoachassemble.entity.YogaGymSignedCoach;
import com.woniuxy.usercoachassemble.service.AdvertisingService;
import com.woniuxy.usercoachassemble.service.CoachInfoService;
import com.woniuxy.usercoachassemble.service.YogaGymInfoService;
import com.woniuxy.usercoachassemble.service.YogaGymSignedCoachService;
import org.example.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author giao桑 故乡的樱花又开了!
 * @version 1.0
 * @Description //TODO
 * @ClassNAME SupController
 * @date 2020/7/22 14:32
 */
@RestController
@RequestMapping("supcontroller")
public class SupController {
    //条件查询教练数据
    @GetMapping("get")
    public Result select() throws Exception{
        return Result.Success();
    }
    //搜索教练
    //交易次数对所有人可见(交易完成统计\评价统计)
    //按条件搜索教练   收费  流派 认证信息 空闲时间(选择时间段与教练空闲时间匹配)
    /*
     * @Description //TODO
     * @Date  2020/7/22 16:11
     * @Param
     * @param value1 认证
     * @param money金额
     * @param cid教练id
     * @return org.example.Result
     **/
    @Autowired
    private CoachInfoService coachInfoService;
    @RequestMapping("selectCoah")
    public Result selectCoah(Boolean value1,Integer money,Integer cid) throws Exception{
        //根据条件查询教练数据
        System.out.println(value1);
        System.out.println(money);
        System.out.println(cid);
        List<Map<String, Object>> list = coachInfoService.slectCaoch(value1, money, cid);
        System.out.println(list);
        return Result.Success(list);
    }
    /*
     * @Description //根据教练id 查询订单数量
     * @Date  2020/7/22 17:03
     * @Param
     * @param cid
     * @return org.example.Result
     **/
    @GetMapping("selectCount")
    public Result selectCount(Integer cid){
        int i = coachInfoService.selectCount(cid);
        System.out.println("交易次数"+i);
        return Result.Success(i);
    }
    /*
     * @Description //查询发布广告
     * @Date  2020/7/22 22:21
     * @Param
     * @return org.example.Result
     **/
    @Autowired
    private AdvertisingService advertisingService;
    @GetMapping("selectAdv")
    public Result selectAdv(){
        return Result.Success(advertisingService.selectAdv());
    }
    @Autowired
    private YogaGymInfoService yogaGymInfoService;

    @GetMapping("selectGym")
    /*查询场馆*/
    public Result selectGym(String yoga_gym_name) {
        //根据场馆名称查询场馆
        List<YogaGymInfo> list = yogaGymInfoService.selectGym(yoga_gym_name);
        System.out.println(list);
        return Result.Success(list);
    }
    @Autowired
    private YogaGymSignedCoachService yogaGymSignedCoachService;
    @GetMapping("selectGymCoach")
    //根据场馆id查询教练数据 yoga_gym_signed_coach
    public Result selectGymCoach(Integer yoga_gym_id){
        List<Map<String, Object>> list = yogaGymSignedCoachService.selectCoach(yoga_gym_id);
        System.out.println(list);
        return Result.Success(list);
    }
}
